import request from '@/utils/request';

// 加载数据
export function load(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/itRoadMap/' + id,
		method: 'get',
	});
}

// 新增2节点
export function saveNode(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/itRoadMap/addNode',
		method: 'post',
		data: data,
	});
}

// 修改节点
export function updateNode(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/itRoadMap/updateNodeById',
		method: 'post',
		data: data,
	});
}

// 删除节点
export function deleteNode(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/itRoadMap/removeNode',
		method: 'post',
		data: data,
	});
}

// 节点连线
export function linkNode(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/itRoadMap/addLink',
		method: 'post',
		data: data,
	});
}

// 删除连线
export function deleteLink(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/itRoadMap/removeLink',
		method: 'post',
		data: data,
	});
}

// 移动节点
export function setLocation(data: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/itRoadMap/setLocation',
		method: 'post',
		data: data,
	});
}

// 查询端类型根据系统id
export function querySegmentType(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/option/querySegmentTypeBySystemCode/' + id,
		method: 'get',
	});
}

// 查询协议
export function queryAgreementResource(): ApiPromise<ApiResponse> {
	return request({
		url: '/management/option/protocol',
		method: 'get',
	});
}

// 获取节点信息
export function getNodeInfo(id: any): ApiPromise<ApiResponse> {
	return request({
		url: '/management/segment/queryById/' + id,
		method: 'get',
	});
}
